// elsePage/pages/pinTuanList/pinTuanList.js

Component({
  properties: {
    dataArr: {
      type: Object,
      value: () => { },
      observer: function (e) {
        this.setData({
          list: e.dataArr,
          style: e.stylesType,
          etime: e.dataArr[0].etime
        })
      }
    }
  },
  data: {
    imgUrl: getApp().globalData.imgUrl,
    imgUrls: getApp().globalData.imgUrls,
    idx: 0,
    indexs: 0,
    list: []
  },
  methods: {
    choose(e) {
      let idx = e.currentTarget.dataset.idx
      if (idx != this.data.idx) {
        this.setData({
          idx,
          indexs: idx
        })
      }
    },
    goBargain(e) {

      if (this.data.etime - Date.now() / 1000 <= 0) {
        wx.showModal({
          title: '提示',
          content: '活动已过期',
          confirmText: '知道了',
        })
        return false
      }
      let goods_id = e.currentTarget.dataset.goods_id,
        activity_id = e.currentTarget.dataset.activity_id;
      wx.navigateTo({
        url: `/pages/groupShop/groupShop?goods_id=${goods_id}&activity_id=${activity_id}`,
      })
    },
    seeMore(e) {
      // if (this.data.etime - Date.now() / 1000 <= 0) {
      //   wx.showModal({
      //     title: '提示',
      //     content: '活动已过期',
      //     confirmText: '知道了',
      //   })
      //   return false
      // }
    
      wx.navigateTo({
        url: `/elsePage/pages/bargain/bargain`,
      })
    }
  }
})